/**
 *
 */
$(document).ready(function () {

    $(".right_bottom a").click(function () {
        var search = $(this).text();
        $("#queryKeysStr").val(search);
    });

    $(".new_question").click(function () {
        var username = $("#top_user_login_tag").val();
        if (username != null) {
            window.location.href = "/ask";
        } else {
            alert("请先登录！");
        }
    });

    $.each($(".hd ul li"), function () {
        $(this).click(function () {
            var li = $(this).text();
            if (li == "全部") {
                window.location.href = "/toWD";
            }
        });
    });

    $.each($(".category1 ul li"), function () {
        $(this).click(function () {
            var type = $(this).text();

            $.ajax({
                url: "/wdtype",
                data: {
                    type: type
                },
                type: "post",
                cache: false,
                dataType: "text",
                success: function (data) {
                    if ("成功" == data) {
                        window.location.href = "/wd";
                    }
                }
            });
        });
    });

    $.each($(".category2 ul li"), function () {
        $(this).click(function () {
            var technology = $(this).text();

            $.ajax({
                url: "/wdtechnology",
                data: {
                    technology: technology
                },
                type: "post",
                cache: false,
                dataType: "text",
                success: function (data) {
                    if ("成功" == data) {
                        window.location.href = "/wd";
                    }
                }
            });
        });
    });

    $.each($(".category3 ul li"), function () {
        $(this).click(function () {
            var product = $(this).text();

            $.ajax({
                url: "/wdproduct",
                data: {
                    product: product
                },
                type: "post",
                cache: false,
                dataType: "text",
                success: function (data) {
                    if ("成功" == data) {
                        window.location.href = "/wd";
                    }
                }
            });
        });
    });

    $(".sear").click(function () {
        var wdsearch = $("#queryStr").val();
        if (wdsearch != null) {
            $("#questionForm").submit();
        }
    });
});